import React from 'react';
import {Route, Switch} from 'react-router-dom';
import {Spin, Icon} from 'antd';
import Loadable from 'react-loadable';
import NotFound from '../error/notFound';
import QueueAnim from 'rc-queue-anim';

function loading() {
    const antIcon = <Icon type="loading" style={{fontSize: 24}} spin/>;
    return <div>
        <Spin indicator={antIcon}/>
    </div>
}

/*----------电站详情路由-----------------*/
const bindCompany = Loadable({
    loader: () => import('../powerStation/bindCompany'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const powerStationManage = Loadable({
    loader: () => import('../powerStation/powerStationManage'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});
const equipmentList = Loadable({
    loader: () => import('../powerStation/equipmentList'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const priceInfo = Loadable({
    loader: () => import('../powerStation/priceInfo'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const chargeOrder = Loadable({
    loader: () => import('../powerStation/chargeOrder'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const equChargeOrder = Loadable({
    loader: () => import('../powerStation/equChargeOrder'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const BaseInfo = Loadable({
    loader: () => import('../powerStation/BaseInfo'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const powerStubManage = Loadable({
	loader: () => import('../powerStation/powerStubManage'), loading() {
		return loading()
	}, render(loaded, props) {
		let Component = loaded.default;
		return <Component {...props}/>;
	}
});

const ledgerRules = Loadable({
	loader: () => import('../powerStation/ledgerRules'), loading() {
		return loading()
	}, render(loaded, props) {
		let Component = loaded.default;
		return <Component {...props}/>;
	}
});

const editLdgerRules = Loadable({
	loader: () => import('../powerStation/editLdgerRules'), loading() {
		return loading()
	}, render(loaded, props) {
		let Component = loaded.default;
		return <Component {...props}/>;
	}
});

const editableTable= Loadable({
	loader: () => import('../powerStation/editableTable'), loading() {
		return loading()
	}, render(loaded, props) {
		let Component = loaded.default;
		return <Component {...props}/>;
	}
});
/*----------订单详情路由------------------*/
const innerEnterprise = Loadable({
    loader: () => import('../order/innerEnterprise'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const publicCharge = Loadable({
    loader: () => import('../order/publicCharge'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const historyCharge = Loadable({
  loader: () => import('../order/historyCharge'), loading() {
    return loading()
  }, render(loaded, props) {
    let Component = loaded.default;
    return <Component {...props}/>;
  }
});

const recentCharge = Loadable({
  loader: () => import('../order/recentCharge'), loading() {
    return loading()
  }, render(loaded, props) {
    let Component = loaded.default;
    return <Component {...props}/>;
  }
});

/*----------人员------------------*/
const staffManage = Loadable({
    loader: () => import('../staff/staffManage'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const rechargeManage = Loadable({
    loader: () => import('../staff/rechargeManage'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const carManage = Loadable({
    loader: () => import('../staff/carManage'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const addCar = Loadable({
    loader: () => import('../staff/addCar'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const addStaff = Loadable({
    loader: () => import('../staff/addStaff'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

/*----------test------------------*/
const chargeProcess = Loadable({
    loader: () => import('../order/chargeProcess'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const CardList = Loadable({
    loader: () => import('../staff/cardList'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

/*--------------企业---------------*/
const ecard =Loadable({
    loader: () => import('../company/ecard'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const sms =Loadable({
    loader: () => import('../company/sms'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const stub =Loadable({
    loader: () => import('../company/stub'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const AddCompany = Loadable({
    loader: () => import('../company/AddCompany'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const AddComDetails = Loadable({
    loader: () => import('../company/AddComDetails'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const CompanyManage = Loadable({
    loader: () => import('../company/CompanyManage'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const CompanyInfo = Loadable({
    loader: () => import('../company/companyInfo'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const ChildAccountList = Loadable({
    loader: () => import('../company/childAccountList'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const AddAccount = Loadable({
    loader: () => import('../../containers/company/addAccount'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const ModifyPass = Loadable({
    loader: () => import('../../containers/company/modifyPass'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const NewRoleManager = Loadable({
    loader: () => import('../../containers/company/newRoleManager'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const AddRole = Loadable({
    loader: () => import('../../containers/company/AddRole'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});


/*-----------财务--员工充值---------*/
// const subAccountList = Loadable({
//     loader: () => import('../finance/subAccountList'), loading() {
//         return loading()
//     }, render(loaded, props) {
//         let Component = loaded.default;
//         return <Component {...props}/>;
//     }
// });

const StaffRecharge = Loadable({
    loader: () => import('../finance/staffRecharge'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const staffTotal = Loadable({
    loader: () => import('../finance/staffTotal'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const childSettle = Loadable({
  loader: () => import('../finance/childSettleList'), loading() {
    return loading()
  }, render(loaded, props) {
    let Component = loaded.default;
    return <Component {...props}/>;
  }
});

const Settlement = Loadable({
    loader: () => import('../finance/Settlement'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const BillDetails = Loadable({
    loader: () => import('../finance/BillDetails'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});


const OrderDetails = Loadable({
    loader: () => import('../finance/OrderDetails'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const MonthlyBill = Loadable({
    loader: () => import('../finance/MonthlyBill'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const BillDetails4Month = Loadable({
    loader: () => import('../finance/BillDetails4Month'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

///finance/OrderDetails4Months
const OrderDetails4Months = Loadable({
    loader: () => import('../finance/OrderDetails4Months'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const Tax = Loadable({
    loader: () => import('../finance/Tax'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const TaxDetails = Loadable({
    loader: () => import('../finance/TaxDetails'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const TaxOrderList = Loadable({
    loader: () => import('../finance/TaxOrderList'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const SubAccount = Loadable({
    loader: () => import('../finance/SubAccount'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const MerchantLedgerSettlement = Loadable({
	loader: () => import('../finance/MerchantLedgerSettlement'), loading() {
		return loading()
	}, render(loaded, props) {
		let Component = loaded.default;
		return <Component {...props}/>;
	}
});

const merchantSettlementDetail = Loadable({
	loader: () => import('../finance/merchantSettlementDetail'), loading() {
		return loading()
	}, render(loaded, props) {
		let Component = loaded.default;
		return <Component {...props}/>;
	}
});
const merchantLedgerOrder = Loadable({
	loader: () => import('../finance/merchantLedgerOrder'), loading() {
		return loading()
	}, render(loaded, props) {
		let Component = loaded.default;
		return <Component {...props}/>;
	}
});

const merchantAdjust = Loadable({
	loader: () => import('../finance/merchantAdjust'), loading() {
		return loading()
	}, render(loaded, props) {
		let Component = loaded.default;
		return <Component {...props}/>;
	}
});

const ledgerMonthBill=Loadable({
	loader: () => import('../finance/ledgerMonthBill'), loading() {
		return loading()
	}, render(loaded, props) {
		let Component = loaded.default;
		return <Component {...props}/>;
	}
});

const ledgerMonthDetail=Loadable({
	loader: () => import('../finance/ledgerMonthDetail'), loading() {
		return loading()
	}, render(loaded, props) {
		let Component = loaded.default;
		return <Component {...props}/>;
	}
});

const ledgerMonthStatDetail = Loadable({
  loader: () => import('../finance/ledgerMonthStatDetail'), loading() {
    return loading()
  }, render(loaded, props) {
    let Component = loaded.default;
    return <Component {...props}/>;
  }
});

const ledgerMonthOrderList=Loadable({
	loader: () => import('../finance/ledgerMonthOrderList'), loading() {
		return loading()
	}, render(loaded, props) {
		let Component = loaded.default;
		return <Component {...props}/>;
	}
});

const ledgerMonthMyOrderList=Loadable({
  loader: () => import('../finance/ledgerMonthMyOrderList'), loading() {
    return loading()
  }, render(loaded, props) {
    let Component = loaded.default;
    return <Component {...props}/>;
  }
});

const merchantStatistics=Loadable({
	loader: () => import('../finance/merchantStatistics'), loading() {
		return loading()
	}, render(loaded, props) {
		let Component = loaded.default;
		return <Component {...props}/>;
	}
});
const discountDetail=Loadable({
	loader: () => import('../finance/discountDetail'), loading() {
		return loading()
	}, render(loaded, props) {
		let Component = loaded.default;
		return <Component {...props}/>;
	}
});
/*-------------充电明细(统计)------------*/
const ChooseSite = Loadable({
    loader: () => import('../../components/Amap/ChooseSite'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});
const stubMonitor = Loadable({
    loader: () => import('../monitor/stubMonitor'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});
const stationMap = Loadable({
    loader: () => import('../monitor/stationMap'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});
const monitorPlan = Loadable({
    loader: () => import('../monitor/monitorPlan'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});
const AddTask = Loadable({
    loader: () => import('../monitor/AddTask'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});
const Test = Loadable({
    loader: () => import('../interconnection/Test'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});
const Stub = Loadable({
    loader: () => import('../interconnection/stub'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});
const divisionManagement = Loadable({
    loader: () => import('../staff/divisionManagement'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

/*----------------数据------------------*/
const OperationReport = Loadable({
    loader: () => import('../data/operationReport'), loading() {
        return loading()
    },
    render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const UserChargeReport = Loadable({
    loader: () => import('../data/userChargeReport'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});

const TimeSharing = Loadable({
    loader: () => import('../data/timeSharing'), loading() {
        return loading()
    }, render(loaded, props) {
        let Component = loaded.default;
        return <Component {...props}/>;
    }
});


class Routers extends React.Component {
    render() {
        return (
            <Switch>
                <Route path="/powerStation/bindCompany" component={bindCompany}/>
                <Route path="/powerStation/powerStationManage" component={powerStationManage}/>
                <Route path="/powerStation/chargeOrder" component={chargeOrder}/>
                <QueueAnim>
                <Route key='123' path="/powerStation/equipmentList" component={equipmentList}/>
                </QueueAnim>
                <Route path="/powerStation/equChargeOrder" component={equChargeOrder}/>
                <Route path="/powerStation/priceInfo" component={priceInfo}/>
                <Route path="/powerStation/baseInfo" component={BaseInfo}/>
				<Route path="/powerStation/powerStubManage" component={powerStubManage}/>
				<Route path="/powerStation/ledgerRules" component={ledgerRules}/>
				<Route path="/powerStation/editLdgerRules" component={editLdgerRules}/>
				<Route path="/powerStation/editableTable" component={editableTable}/>
                <Route path="/order/innerEnterprise" component={innerEnterprise}/>
                <Route path="/order/publicCharge" component={publicCharge}/>
                <Route path="/order/historyCharge" component={historyCharge}/>
                <Route path="/order/recentCharge" component={recentCharge}/>
                <Route path="/order/chargeProcess" component={chargeProcess}/>
                <Route path="/staff/staffManage" component={staffManage}/>
                <Route path="/staff/carManage" component={carManage}/>
                <Route path="/staff/addCar" component={addCar}/>
                <Route path="/staff/addStaff" component={addStaff}/>
                <Route path='/staff/cardList' component={CardList}/>
                <Route path='/staff/rechargeManage' component={rechargeManage}/>
                <Route path='/divisionManagement/divisionManagement' component={divisionManagement}/>
                <Route path='/company/ecard' component={ecard}/>
                <Route path='/company/sms' component={sms}/>
                <Route path='/company/stub' component={stub}/>
                <Route path='/company/CompanyManage' component={CompanyManage}/>
                <Route path='/company/AddCompany' component={AddCompany}/>
                <Route path='/company/AddComDetails' component={AddComDetails}/>
                <Route path='/company/companyInfo' component={CompanyInfo}/>
                <Route path='/company/childAccountList' component={ChildAccountList}/>
                <Route path='/company/addAccount' component={AddAccount}/>
                <Route path='/company/modifyPass' component={ModifyPass}/>
                <Route path='/company/newRoleManager' component={NewRoleManager}/>
                <Route path='/company/addRole' component={AddRole}/>
                <Route path='/finance/staffRecharge' component={StaffRecharge}/>
                <Route path='/finance/staffTotal' component={staffTotal}/>
                <Route path='/finance/Settlement' component={Settlement}/>
                <Route path='/finance/MonthlyBill' component={MonthlyBill}/>
                <Route path="/finance/BillDetails" component={BillDetails}/>
                <Route path="/finance/OrderDetails" component={OrderDetails}/>
                <Route path="/finance/BillDetails4Month" component={BillDetails4Month}/>
                <Route path="/finance/OrderDetails4Months" component={OrderDetails4Months}/>
                <Route path="/finance/Tax" component={Tax}/>
                <Route path="/finance/TaxDetails" component={TaxDetails}/>
                <Route path="/finance/TaxOrderList" component={TaxOrderList}/>
                <Route path="/finance/SubAccount" component={SubAccount}/>
				<Route path="/finance/MerchantLedgerSettlement" component={MerchantLedgerSettlement}/>
				<Route path="/finance/merchantSettlementDetail" component={merchantSettlementDetail}/>
				<Route path="/finance/merchantLedgerOrder" component={merchantLedgerOrder}/>
				<Route path="/finance/merchantAdjust" component={merchantAdjust}/>
				<Route path="/finance/ledgerMonthBill" component={ledgerMonthBill}/>
				<Route path="/finance/ledgerMonthDetail" component={ledgerMonthDetail}/>
                <Route path="/finance/ledgerMonthStatDetail" component={ledgerMonthStatDetail}/>
                <Route path="/finance/ledgerMonthOrderList" component={ledgerMonthOrderList}/>
                <Route path="/finance/ledgerMonthMyOrderList" component={ledgerMonthMyOrderList}/>
				<Route path="/finance/merchantStatistics" component={merchantStatistics}/>
				<Route path="/finance/discountDetail" component={discountDetail}/>
                <Route path="/finance/childSettlelist" component={childSettle}/>
                <Route path='/data/userChargeReport' component={UserChargeReport}/>
                <Route path='/data/operationReport' component={OperationReport}/>
                <Route path='/data/timeSharing' component={TimeSharing}/>
                <Route path='/monitor/stationMap' component={stationMap}/>
                <Route path='/monitor/stubMonitor' component={stubMonitor}/>
                <Route path='/monitor/monitorPlan' component={monitorPlan}/>
                <Route path='/monitor/addTask' component={AddTask}/>
                <Route path='/interconnection/test' component={Test}/>
                <Route path='/interconnection/stub' component={Stub}/>
                <Route path='/test' component={ChooseSite}/>
                <Route component={NotFound}/>
            </Switch>
        )
    }
}

export default Routers;